package org.example.product.controller.front;

import org.example.core.utils.R;
import org.example.product.entity.CategoryEntity;
import org.example.product.service.HomeService;
import org.example.product.vo.CategoryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 小杰_cc
 * @version 1.0
 */
@RestController
@RequestMapping("/pms/front/home")
public class HomeController {

    @Autowired
    private HomeService homeService;

    // 获取首页一级分类
//    @GetMapping("/category")
//    public R<List<CategoryEntity>> categoryTree(){
//        List<CategoryEntity> entities = homeService.queryCategoryTree();
//        return R.ok(entities);
//    }

    // 获取所有分类
    @GetMapping("/categoryTree")
    public R<List<CategoryVo>> categoryTree(){
        List<CategoryVo> entities = homeService.queryCategoryTree();
        return R.ok(entities);
    }
}
